Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@uppy/utils
Advanced tools
Shared utility functions for Uppy Core and plugins maintained by the Uppy team.
@uppy/utils is a utility library that provides a set of helper functions for working with files, URLs, and other common tasks in JavaScript. It is part of the Uppy file uploader ecosystem and is designed to simplify various operations related to file handling and manipulation.
getFileNameAndExtension
This function extracts the file name and extension from a given file path or URL.
const { getFileNameAndExtension } = require('@uppy/utils');
const { name, extension } = getFileNameAndExtension('example.txt');
console.log(name); // 'example'
console.log(extension); // 'txt'
getSafeFileName
This function sanitizes a file name by replacing unsafe characters with safe ones.
const { getSafeFileName } = require('@uppy/utils');
const safeName = getSafeFileName('example file.txt');
console.log(safeName); // 'example-file.txt'
generateFileID
This function generates a unique ID for a file based on its properties such as name, type, and size.
const { generateFileID } = require('@uppy/utils');
const fileID = generateFileID({ name: 'example.txt', type: 'text/plain', size: 1024 });
console.log(fileID); // A unique file ID based on the file's properties
isPreviewSupported
This function checks if a given MIME type is supported for preview.
const { isPreviewSupported } = require('@uppy/utils');
const supported = isPreviewSupported('image/jpeg');
console.log(supported); // true
The 'file-type' package is used to detect the file type of a Buffer/Uint8Array/ArrayBuffer. It is similar to @uppy/utils in that it helps with file handling, but it focuses specifically on detecting file types rather than providing a broader set of utilities.
The 'mime' package is used to look up the MIME type of a file based on its extension. It is similar to @uppy/utils in that it deals with file types and extensions, but it does not provide the same range of utilities for file manipulation.
The 'sanitize-filename' package is used to sanitize file names by removing or replacing unsafe characters. It is similar to the getSafeFileName function in @uppy/utils, but it is focused solely on sanitizing file names.
Shared utility functions for Uppy Core and the “official” plugins maintained by the Uppy team.
Uppy is being developed by the folks at Transloadit, a versatile file encoding service.
Unless you are creating a custom plugin, you should not need to install this manually.
$ npm install @uppy/utils
FAQs
Shared utility functions for Uppy Core and plugins maintained by the Uppy team.
The npm package @uppy/utils receives a total of 182,160 weekly downloads. As such, @uppy/utils popularity was classified as popular.
We found that @uppy/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.